<?php
namespace app\admin\controller;
use app\admin\controller\Common;
use think\Db;
use app\admin\model\Admin as AdminModel;
class Messagn extends Common
{	
    public function index($page=1)
    {	
        $each = 10;  //每页显示多少条
        @$dbtable = messagn;    //数据表名
    	$pages = new AdminModel();
    	$res = $pages->page($page,$each,$dbtable);
    	if($res==-1){
    		$this->error('没有此页面');
    	}
    	$this->assign(array(
    		'list' => $res['list'],
    		'pagetotal' => $res['pagetotal'],
    		'page' => $res['page'],
    	));
        return view();
    }

    public function del($id) 
    {
        $res = db('messagn')->delete($id);
        if ($res) {
            $this->success('删除成功','Messagn/index');
        }else{
            $this->error('删除失败');
        }
    }
}
